const cloud = require('wx-server-sdk'),
  got = require('got');

cloud.init();

exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext();
  try {
    let req_url =
      'http://tiaocaoer.com:18882/save_formid?openid=' +
      wxContext.OPENID +
      '&form_id=' +
      event.form_id;
    const res = await got(req_url);
    console.log(res.body);

    console.log(JSON.stringify(event));
  } catch (err) {
    console.log(err);
    return err;
  }
};
